package com.cultraview;

import org.opencv.core.Core;
import org.opencv.core.CvType;
import org.opencv.core.Mat;
import org.opencv.core.Rect;
import org.opencv.core.Scalar;
import org.opencv.core.Size;
import org.opencv.highgui.HighGui;
import org.opencv.imgcodecs.Imgcodecs;
import org.opencv.imgproc.Imgproc;

class TesterRun {
	private Mat src;
	private Mat src_gray = new Mat();

	public void run(String[] args) {
		System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
		Mat mat = Mat.eye(3, 3, CvType.CV_8UC1);
		System.out.println("mat = " + mat.dump());

		System.out.println("Welcome to OpenCV " + Core.VERSION);
//		Mat m = new Mat(5, 10, CvType.CV_8UC1, new Scalar(0));
//		System.out.println("OpenCV Mat: " + m);
//		Mat mr1 = m.row(1);
//		mr1.setTo(new Scalar(1));
//		Mat mc5 = m.col(5);
//		mc5.setTo(new Scalar(5));
//		System.out.println("OpenCV Mat data:\n" + m.dump());

		src = Imgcodecs.imread("./data/ori.png", Imgcodecs.IMREAD_COLOR);
		HighGui.namedWindow("Input", HighGui.WINDOW_AUTOSIZE);
		HighGui.namedWindow("Predel", HighGui.WINDOW_AUTOSIZE);
		
		
        /// Convert image to gray and blur it
        Imgproc.cvtColor(src, src_gray, Imgproc.COLOR_BGR2GRAY);
        HighGui.imshow( "Input", src );
        Imgproc.blur(src_gray, src_gray, new Size(3, 3));
        HighGui.imshow( "Predel", src_gray );
        
		HighGui.waitKey();
	}

}

public class Tester {
    public static void main(String[] args) {
        // Load the native library.
        System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
        new TesterRun().run(args);
    }
}